//
//  loginView.m
//  projectOfTeamSample
//
//  Created by lanou3g on 15/11/18.
//  Copyright © 2015年 liukai. All rights reserved.
//

#import "loginView.h"

@interface loginView ()

@end

@implementation loginView

-(id)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self layoutLoginView];
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

-(void)layoutLoginView{
    CGRect frame = [UIScreen mainScreen].bounds;
//user
    self.userLable = [[UILabel alloc]initWithFrame:CGRectMake(frame.origin.x + 50,frame.origin.y +130,60, 30)];
    self.userLable.textColor = [UIColor whiteColor];
    self.userText = [[UITextField alloc]initWithFrame:CGRectMake(self.userLable.frame.origin.x + 70,self.userLable.frame.origin.y, self.userLable.frame.size.width + 150, 30)];
    self.userText.alpha = 0.6;
    self.userText.borderStyle =UITextBorderStyleRoundedRect;
    self.userText.layer.cornerRadius = 5;
    self.userText.layer.borderColor = [UIColor darkGrayColor].CGColor;
    self.userText.layer.borderWidth = 1;
    
//password
    self.passwordLable = [[UILabel alloc]initWithFrame:CGRectMake(frame.origin.x + 50, frame.origin.y +170, 60, 30)];
    self.passwordText = [[UITextField alloc]initWithFrame:CGRectMake(self.passwordLable.frame.origin.x + 70,self.passwordLable.frame.origin.y, self.passwordLable.frame.size.width + 150, 30)];
    self.passwordLable.textColor = [UIColor whiteColor];
    self.passwordText.alpha = 0.6;
    self.passwordText.borderStyle = UITextBorderStyleRoundedRect;
    self.passwordText.layer.borderColor = [UIColor darkGrayColor].CGColor;
    self.passwordText.layer.borderWidth = 1;
    self.passwordText.layer.cornerRadius = 5;
    self.passwordText.secureTextEntry = YES;
    
    self.passwordText.clipsToBounds = YES;
   
//loginButton
    self.loginButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    self.loginButton.frame = CGRectMake(frame.origin.x + 50,self.passwordLable.frame.origin.y + 400, 80, 40);
    self.loginButton.alpha = 0.7;
    self.loginButton.layer.cornerRadius = 19;
    self.loginButton.layer.masksToBounds = YES;
    
    
//registButton
    self.registButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    self.registButton.frame = CGRectMake(frame.origin.x + 165, self.passwordLable.frame.origin.y + 400, 80, 40);
    self.registButton.alpha = 0.7;
    self.registButton.layer.cornerRadius = 19;
    self.registButton.layer.masksToBounds = YES;
    
//getbackPasswordButton
    self.getBackPasswordButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    self.getBackPasswordButton.frame = CGRectMake(frame.origin.x +280, self.passwordLable.frame.origin.y + 400, 80, 40);
    self.getBackPasswordButton.alpha = 0.7;
    self.getBackPasswordButton.layer.cornerRadius = 19;
    self.getBackPasswordButton.layer.masksToBounds = YES;
    
    [self addSubview:self.userLable];
    [self addSubview:self.userText];
    [self addSubview:self.passwordLable];
    [self addSubview:self.passwordText];
    [self addSubview:self.loginButton];
    [self addSubview:self.registButton];
    [self addSubview:self.getBackPasswordButton];
    [self getLoginSource];
}

-(void)getLoginSource{
    self.userLable.text = @"用户名:";
    self.passwordLable.text = @"密码:";
    self.userText.placeholder = @"请输入用户名";
    self.passwordText.placeholder = @"请输入密码";
    
    [self.loginButton setBackgroundImage:[UIImage imageNamed:@"5a.jpg"] forState:(UIControlStateNormal)];
    [self.registButton setBackgroundImage:[UIImage imageNamed:@"5a.jpg"] forState:UIControlStateNormal];
    [self.getBackPasswordButton setBackgroundImage:[UIImage imageNamed:@"5a.jpg"] forState:UIControlStateNormal];
    
    [self.loginButton setTitle:@"Login" forState:(UIControlStateNormal)];
    [self.registButton setTitle:@"Regist" forState:(UIControlStateNormal)];
    [self.getBackPasswordButton setTitle:@"找回密码" forState:(UIControlStateNormal)];
    
    self.loginButton.tintColor = [UIColor whiteColor];
    self.registButton.tintColor = [UIColor whiteColor];
    self.getBackPasswordButton.tintColor = [UIColor whiteColor];
}




/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
